
$(function () {
    var t = setInterval(dataTime, 1000);
    $(".form_datetime").datetimepicker({
        format: "yyyy-mm-dd hh:ii",
        language : 'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1,
        initialDate : new Date(),
        pickerPosition:'top-right',
    });
})

function dataTime() {
    var myDate = new Date;
    var year = myDate.getFullYear();//获取当前年
    var month = myDate.getMonth() + 1;//获取当前月
    var date = myDate.getDate();//获取当前日
    var hours = myDate.getHours();//获取当前小时数(0-23)
    var min = myDate.getMinutes();//获取当前分钟数(0-59)
    var s = myDate.getSeconds();//获取当前秒
    month = (month < 10) ? "0" + month : month;
    date = (date < 10) ? "0" + date : date;
    hours = (hours < 10) ? "0" + hours : hours;
    min = (min < 10) ? "0" + min : min;
    s = (s < 10) ? "0" + s : s;
    $('#time').text(year + "年" + month + "月" + date + "日  " + hours
        + ":" + min + ":" + s)
    $('#time_txt').text('当前时间：')
}